<%@ page contentType="text/html; charset=UTF-8"%>

<%@ page import="java.util.HashMap"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.List"%>

<%
String error_code = request.getParameter("error");
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <title>系统登录</title>

   <!-- jquery -->
   <script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
   
   <!-- jeasy ui -->
   <link rel="stylesheet" type="text/css" href="jeasyui/themes/default/easyui.css">
   <link rel="stylesheet" type="text/css" href="jeasyui/themes/icon.css">
   
   <script type="text/javascript" src="jeasyui/jquery.easyui.min.js"></script>
   <script type="text/javascript" src="jeasyui/locale/easyui-lang-zh_CN.js"></script>
   
   
   <style>
   .cover {
   	width: 868px;
   	height: 317px;
   	margin: 0px auto;
   	/*background: url(images/box.png) no-repeat center top;*/
   	position: relative
   }
   
   .login {
   	font-size: 14px;
   	color: #000;
   	position: absolute;
   	top: 85px;
   	left: 635px;
   	width: 206px;
   }
   
   .login td {
   	vertical-align: middle;
   }
   
   .login th {
   	vertical-align: middle;
   	white-space: nowrap;
   	font-weight: normal
   }
   
   .login input {
   	height: 25px;
   	width: 120px;
   	font-size: 12px;
   	vertical-align: middle;
   	line-height: 25px;
   	background: #fff;
   	border: 1px solid #ccc;
   }
   
   #textfield {
   	background: url(ico/i1.gif) no-repeat 4px center #fff;
   	padding-left: 20px;
   }
   
   #textfield2 {
   	background: url(ico/i2.gif) no-repeat 4px center #fff;
   	padding-left: 20px;
   }
   
   .btn {
   	position: absolute;
   	top: 186px;
   	left: 37px;
   }
   
   .foot {
   	color: #fff;
   	text-align: center;
   	margin: auto;
   	padding: 30px;
   	font-size: 12px;
   }
   </style>

</head>

<body>
   <div id="frame_home_page_content" class="easyui-layout" data-options="fit:true"> 
      <div data-options="region:'center'" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" 
           style="text-align: center; background: url(images/back.gif) center top #32a0b5; padding-top: 80px;">
          
         <div class="tit" style="margin: 0 auto 10px">
            <!-- <img src="images/tit.png" width="552" height="91"> -->
         </div>
         
         <div class="cover">
            <form id='login' name='login' action="${pageContext.request.contextPath}/j_spring_security_check" method='post'>  
               <table border="0" cellspacing="0" cellpadding="4" class="login">
                  <tr>
                     <th>帐 号<br></th>
                     <td><input type="text" id="j_username" name="j_username"></td>
                  </tr>
                  <tr>
                     <th>密 码</th>
                     <td><input type="password" id="j_password" name="j_password" onkeydown="javascript:KeyDown(event)"></td>
                  </tr>
                  
                  <tr>
                     <th>验证码</th>
                     <td>
                        <input type="text" name="code" id="textfield3" style="width: 60px;"
                               onkeydown="javascript:fun_key_down(event)">
                        <img src="code.jsp" id="imagecode" name="imagecode" alt="验证码" width="42" height="24" hspace="8"/>
                     </td>
                  </tr>
                  
                  <tr>
                     <td colspan="2">
                        <a href="#" onclick="javascript:fun_login_load_image()"> 看不清？</a>
                        <a href="#" onclick="javascript:fun_login_return_password()">取回密码</a>
                     </td>
                  </tr>
                  
                  <tr>
                     <td colspan="2" style="text-align: center">
                        <a href="javascript:checkForm()">
                           <img src="images/btn.png" width="146" height="48" border="0" onkeydown="javascript:fun_key_down(event)">
                        </a>
                     </td>
                  </tr>
                  
               </table>
            </form>
         </div>
   
         <!--
         <div class="foot">
请使用IE（IE8以上）、firefox及Google Chrome等主流浏览器访问本系统<br/><br/>
为保证最佳使用效果，推荐使用Google Chrome浏览器，<a href="/frqjw/download/ChromeStandaloneSetup.exe">点击安装</a>chrome浏览器<br/><br/>
技术支持：
         </div>
         -->
            
      </div>
   </div>
   
</body>
   

<script type="text/javascript">

   function fun_key_down(event)
   {  
      var currKey = event.keyCode;
      
      if(currKey == 13)
      {   
   	   checkForm();
      }
   }
   
   function checkForm()
   {
      var thisForm = document.login;
      //var thisForm = $('form[name=login]')[0];
      
   	if(thisForm.j_username.value == null || thisForm.j_username.value == '' || thisForm.j_username.value.length == 0)
      {
         $.messager.alert('操作提示', '用户名不能为空！');
         //thisForm.j_username.focus();
      
         return ;
      }
      else if(thisForm.j_password.value == null || thisForm.j_password.value == "")
      {
   	   $.messager.alert('操作提示', '密码不能为空！');
   	   //thisForm.j_password.focus();
   	   
         return ;
      }
   	/*
      else if(thisForm.code.value == null || thisForm.code.value == "")
      {
   	   $.messager.alert('操作提示', '验证码不能为空！');
   	   //thisForm.code.focus();
   	   
         return ;
      }
   	*/
      
      //将原来的直接提交登录名,改成:'机构代码+,+登录名';提交到后台 bzq 2011-04-15
      //thisForm.j_username.value = thisForm.j_username.value+","+thisForm.j_organCode.value;
      //thisForm.j_username.value = encodeURI(thisForm.j_username.value);
         
      thisForm.submit();
   }
   
   function fun_login_load_image()
   {
      document.getElementById('imagecode').src='./code.jsp?t='+new Date().getTime();
   }

   
   function fun_print_error_msg()
   {
      var error_code = '<%=error_code%>';
      
      if(error_code == 1)
      {
         $.messager.alert('操作提示', '您输入的用户名或密码不正确！');
      }
      else if(error_code == 2)
 	   {
    	  $.messager.alert('操作提示', '您输入的验证码不正确！');
 	   }
      else
 	   {
 	   
 	   }
   }
   
   fun_print_error_msg();
   
</script>


</html>